<extend name="Public/base" />
<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a class="tip-bottom" href="{:U('Index/index')}" data-original-title="首页"><i class="icon-home"></i> 首页</a>
			<a class="current" href="{$post_url}">{$meta_title}</a>
		</div>
	</div>
    <div class="container-fluid" style="margin-top:15px;">
        <!-- 活动信息 -->
        <div class="row-fluid">
            <form method="post" autocomplete="off">  
            	<div><h4>待分配客户  {$count_num} 名</h4></div>
				<div class="control" id="member_list" style="margin:20px 0 5px 0;"></div>
				<br/>
				<button class="btn btn-success" type="submit">确定分配</button>
				<volist name="customer_id" id="vo">
					<input type="hidden" name="customer_id[]" value="{$vo}"/>
				</volist>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
$(function (){
    //员工加载
    $.ajax({ url: "{:U('ServiceStatistics/getMemberList')}", data: { member_value : '{$member_value}',type:1} , success: function(data){
    	if('' != data){
        	$('#member_list').html(data).hide().fadeIn(300);
    	}
        //初始化控件
        var IS_INIT = 1;
     	// 全选
        $(".checkbox-all").bind("click",function(){
            $(this).nextAll("div.checkbox-group").children("label").children("input").prop("checked", true);
        });
        // 反选
        $(".checkbox-opposite").bind("click",function(){
            $(this).nextAll("div.checkbox-group").children("label").children("input[type=checkbox]").each(function(e) {
                if ($(this).is(":checked")) {
                    $(this).prop("checked", false);
                }else{
                    $(this).prop("checked", true);
                }
            });
        });
	}});
})

$(document).ready(function(){
	//初始化登录用户名输入焦点
	tke_form_focus();
	$("form").submit(function(){
		//锁定登录按钮
		$('button').attr('disabled',true);
		var self = $(this);
		$.post("{:U('ServiceManage/changeBindCustomerSave')}", self.serialize(), call_back, "json");
		return false;
		
		/**
		 * @todo 接收登录返回值
		 * @author PHP@妖孽 <dino_ma@163.com>
		 */
		function call_back(data){
			if(data.status==1){
				tke_alert(data.info,'alert-success');
				setTimeout(function(){
				  if (data.url) {
						location.href=data.url;
					}else{
						location.reload();
					}
				},1500);
			} else {
				$('button').attr('disabled',false);
				tke_alert(data.info,'alert-error');
			}
		}
	});
	//导航高亮
	highlight_subnav("{:U('ServiceManage/changeBindCustomer')}");
});
</script>
</block>